package com.info.dpunified.defects.dataaccess.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import com.info.dpunified.common.MappingConstants;
import com.info.dpunified.common.utils.DPUUnifiedConstants;
import com.info.dpunified.defects.transfer.DefectsSelection;

public class DefectsSelectorResultSetExtractor implements ResultSetExtractor, DPUUnifiedConstants{

	@Override
	public Object extractData(ResultSet rs) throws SQLException,
			DataAccessException {
			
		
			DefectsSelection defectsSelection = new DefectsSelection();
			
			defectsSelection.setMonth(MappingConstants.getMonthMap().get(rs.getString(MONTH)));
			defectsSelection.setYear(rs.getString(YEAR));
			defectsSelection.setProjectCode(rs.getString(PROJECTCODE));
			defectsSelection.setType(rs.getString(DEFECTTYPE));
			defectsSelection.setStatus(rs.getString(DEFECTSTATUS));
			defectsSelection.setSeverity(rs.getString(DEFECTSEVERITY));
			defectsSelection.setPriority(rs.getString(DEFECTPRIORITY));
			defectsSelection.setImpact(rs.getString(DEFECTIMPACT));
			
			return defectsSelection;
	}

}
